import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/index/Index'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',   //首页
    name: 'index',
    component: Index,
    children:[
      //发布红包
      {
        path:'/publish/:type',   //type normal=普通红包  pic=图片红包 slide=幻灯红包 video=视频红包
        name:'publish',
        component: () => import("../views/children/publish/Publish.vue"),
        meta:{
          title:"发红包"
        }
      },
      //红包领取记录
      {
        path:'/record/:red_id',   //red_id 红包id
        name:'record',
        component: () => import("../views/children/record/Record.vue"),
        meta:{
          title:"红包记录"
        }
      },
      // 手机认证
      {
        path:'/index/phone',
        name:'index-phone',
        component: () => import("../views/children/phone/Phone.vue"),
        meta:{
          title:"手机认证"
        }
      }
    ]
  },
  {
    path: '/me',
    name: 'me',
    component: () => import('../views/me/Me.vue'),
    meta:{
      title:"个人中心"
    },
    children:[
      // 手机认证
      {
        path:'/me/phone',
        name:'me-phone',
        component: () => import("../views/children/phone/Phone.vue"),
        meta:{
          title:"手机认证"
        }
      },
      //发布红包
      {
        path:'/me/publish/:type',   //type normal=普通红包  pic=图片红包 slide=幻灯红包 video=视频红包
        name:'me-publish',
        component: () => import("../views/children/publish/Publish.vue"),
        meta:{
          title:"发红包"
        }
      },
      //提现
      {
        path:'/me/cash',
        name:'cash',
        component: () => import("../views/me/children/cash/Cash.vue"),
        meta:{
          title:"提现"
        }
      },
      //收入记录
      {
        path:'/me/income',
        name:'income',
        component: () => import("../views/me/children/income/Income.vue"),
        meta:{
          title:"收入记录"
        }
      },
      //我发布的红包
      {
        path:'/me/red',
        name:'red',
        component: () => import("../views/me/children/red/Red.vue"),
        meta:{
          title:"我的红包"
        },
        children:[
          {
            path:'/me/red/slide/:red_id',   //red_id 红包id
            name:'me-red-slide',
            component: () => import("../views/me/children/slide/Slide.vue"),
            meta:{
              title:"我的红包"
            },
            children:[
              //红包领取记录
              {
                path:'/me/red/slide/record/:red_id',   //red_id 红包id
                name:'me-red-slide-record',
                component: () => import("../views/children/record/Record.vue"),
                meta:{
                  title:"红包记录"
                }
              }
            ]
          }
        ]
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
